Objective-c HTML->RGB color not correct in UIColor?

The range of valid values for the parameters to colorWithRed:green:blue:alpha: is 0 to 1 Assuming your RGB values have the range 0 to 255, your example would be.

The range of valid values for the parameters to +colorWithRed:green:blue:alpha: is 0 to 1. Assuming your RGB values have the range 0 to 255, your example would be: UIColor colorWithRed:0.92f green:0.95f blue:0.83f alpha:1.f.

Great stuff, thanks. How do I convert the numbers I have to the correct format? – conor Sep 9 '11 at 11:47 1 Divide them by 255.

–? Sep 9 '11 at 12:14.

Simply divide all you color values by 255: UIColor colorWithRed:235/255.0f green:242/255.0f blue:212/255.0f alpha:1.

1 I just wanted to add that the .0f suffix is very important. I used your code without it at first and the color I got was very different. Simply using 57/255 (let's say), doesn't cut it.So to everyone else using this answer, don't forget to add .0f, unlike me :)) – Bogdan Bucur 2 days ago.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions